package com.ruoyi.teaching.service.impl;

import java.util.List;

import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.teaching.mapper.TeachingCoursePriceMapper;
import com.ruoyi.teaching.domain.TeachingCoursePrice;
import com.ruoyi.teaching.service.ITeachingCoursePriceService;
import com.ruoyi.common.core.text.Convert;

/**
 * 收费标准Service业务层处理
 *
 * @author William
 * @date 2022-10-13
 */
@Service
public class TeachingCoursePriceServiceImpl implements ITeachingCoursePriceService {
    @Autowired
    private TeachingCoursePriceMapper teachingCoursePriceMapper;

    /**
     * 查询收费标准
     *
     * @param priceId 收费标准主键
     * @return 收费标准
     */
    @Override
    public TeachingCoursePrice selectTeachingCoursePriceByPriceId(Long priceId) {
        return teachingCoursePriceMapper.selectTeachingCoursePriceByPriceId(priceId);
    }

    /**
     * 查询收费标准列表
     *
     * @param teachingCoursePrice 收费标准
     * @return 收费标准
     */
    @Override
    public List<TeachingCoursePrice> selectTeachingCoursePriceList(TeachingCoursePrice teachingCoursePrice) {
        return teachingCoursePriceMapper.selectTeachingCoursePriceList(teachingCoursePrice);
    }

    /**
     * 新增收费标准
     *
     * @param teachingCoursePrice 收费标准
     * @return 结果
     */
    @Override
    public int insertTeachingCoursePrice(TeachingCoursePrice teachingCoursePrice) {
        teachingCoursePrice.setCreateTime(DateUtils.getNowDate());
        return teachingCoursePriceMapper.insertTeachingCoursePrice(teachingCoursePrice);
    }

    /**
     * 修改收费标准
     *
     * @param teachingCoursePrice 收费标准
     * @return 结果
     */
    @Override
    public int updateTeachingCoursePrice(TeachingCoursePrice teachingCoursePrice) {
        teachingCoursePrice.setUpdateTime(DateUtils.getNowDate());
        return teachingCoursePriceMapper.updateTeachingCoursePrice(teachingCoursePrice);
    }

    /**
     * 批量删除收费标准
     *
     * @param priceIds 需要删除的收费标准主键
     * @return 结果
     */
    @Override
    public int deleteTeachingCoursePriceByPriceIds(String priceIds) {
        return teachingCoursePriceMapper.deleteTeachingCoursePriceByPriceIds(Convert.toStrArray(priceIds));
    }

    /**
     * 删除收费标准信息
     *
     * @param priceId 收费标准主键
     * @return 结果
     */
    @Override
    public int deleteTeachingCoursePriceByPriceId(Long priceId) {
        return teachingCoursePriceMapper.deleteTeachingCoursePriceByPriceId(priceId);
    }

    /**
     * 根据课程ID和学校ID批量删除收费标准
     *
     * @param courseId 课程ID
     * @param schoolId 学校ID
     */
    @Override
    public void deleteTeachingCoursePriceByCourseIdAndSchoolId(Long courseId, Long schoolId) {
        teachingCoursePriceMapper.deleteTeachingCoursePriceByCourseIdAndSchoolId(courseId, schoolId);
    }

    /**
     * 根据课程ID和学校ID查询收费标准
     *
     * @param courseId 课程ID
     * @param schoolId 学校ID
     */
    @Override
    public List<TeachingCoursePrice> selectTeachingCoursePriceByCourseIdAndSchoolId(Long courseId, Long schoolId) {
        return teachingCoursePriceMapper.selectTeachingCoursePriceByCourseIdAndSchoolId(courseId, schoolId);
    }
}
